package com.star.message.api;

import com.star.message.api.contract.command.SendEmailCommand;
import com.star.message.api.service.MessageEmailApi;
import com.star.message.biz.MessageEmailBizService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RestController;

/**
 * 邮件api
 *
 * @author zhouhengzhe
 */
@RequiredArgsConstructor
@RestController
@Tag(name = "邮件中心", description = "邮件api")
public class MessageEmailApiController implements MessageEmailApi {

    private final MessageEmailBizService messageEmailBizService;

    /**
     * 发送邮件
     *
     * @param sendEmailCommand 邮件信息
     */
    @Override
    @Operation(summary = "发送邮件")
    public void sendEmail(SendEmailCommand sendEmailCommand) {
        messageEmailBizService.sendEmail(sendEmailCommand.getTenantId(), sendEmailCommand.getLanguageCode(), sendEmailCommand.getEmail(), sendEmailCommand.getCode());
    }
}
